var t = getApp(), o = require("../../../api.js"), e = require("../../../utils/function.js");

Page({
    data: {
        img: e.driverImg,
        webRoot: t.webRoot,
        page: 1
    },
    onShow: function() {
        var e = this;
        console.log("---------"), t.request({
            url: o.bank.mybank,
            method: "post",
            data: {
                rows: 10,
                page: e.data.page
            },
            success: function(t) {
                console.log(t), e.setData({
                    data: t.data.data
                });
            }
        });
    },
    onLoad: function() {
        this.setData({
            icons: wx.getStorageSync("site") + "/addons/sd_liferuning/tp/public/uploads/background"
        });
    },
    bankSetup: function(e) {
        var a = this, n = e.currentTarget.dataset.id;
        t.request({
            url: o.bank.is_default,
            method: "post",
            data: {
                id: n
            },
            success: function(t) {
                console.log(t), 1 == t.code ? wx.showModal({
                    title: "提示",
                    content: "设置成功",
                    showCancel: !1,
                    success: function() {
                        a.onShow();
                    }
                }) : wx.showModal({
                    title: "提示",
                    content: "设置失败",
                    showCancel: !1
                });
            }
        });
    },
    del: function(e) {
        var a = this, n = e.currentTarget.dataset.id;
        wx.showModal({
            title: "提示",
            content: "您确定删除吗",
            success: function(e) {
                1 == e.confirm && t.request({
                    url: o.bank.del,
                    method: "post",
                    data: {
                        id: n
                    },
                    success: function(t) {
                        console.log(t), a.onShow();
                    }
                });
            }
        });
    }
});